package fangzhiyi.work.auto;

/**
 * @author fangzhiyi
 * @version 1.0
 * @date 2025/3/20 18:36
 * @description
 */
public class Car extends Auto{
    //属性
    public String hvac;
    public String CD;
    //构造方法
    public Car(int tire, String color, double weight, double speed, String hvac, String CD) {
        super(tire, color, weight, speed);
        this.hvac = hvac;
        this.CD = CD;
    }
    //覆盖加速
    public void addSpeed(double carSpeed){
        this.speed = this.speed+carSpeed;
        System.out.println("小汽车加速，当前速度为"+this.speed+"km/h");
    }
    //覆盖减速
    public void minusSpeed(double carSpeed){
        this.speed = this.speed-carSpeed;
        if (this.speed>0){
            System.out.println("汽车减速,当前速度为"+this.speed+"km/h");
        }else {
            this.speed = 0;
            System.out.println("汽车停车");
        }
    }
    public void stopSpeed(){
        System.out.println("汽车停车");
    }

}
